# Contributor: Pedro Filipe <xpecex@outlook.com>
# Contributor: G.J.R. Timmer <gjr.timmer@gmail.com>
# Maintainer: G.J.R. Timmer <gjr.timmer@gmail.com>
# TODO: run tests!
pkgname=check_postgres
pkgver=2.25.0
pkgrel=2
pkgdesc="PostgreSQL monitoring script"
url="https://bucardo.org/check_postgres/"
arch="noarch"
license="BSD-2-Clause"
depends="postgresql perl"
makedepends="perl-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/bucardo/check_postgres/archive/$pkgver.tar.gz"

build() {
	perl Makefile.PL \
		INSTALL_BASE=/usr \
		INSTALLMAN1DIR=/usr/share/man/man1 \
		INSTALLSITEMAN1DIR=/usr/share/man/man1 \
		INSTALLMAN3DIR=/usr/share/man/man3 \
		INSTALLSITEMAN3DIR=/usr/share/man/man3
	make
}

package() {
	make DESTDIR="$pkgdir" install

	# Fix file extension because MakeMaker cannot do this
	mv "$pkgdir"/usr/bin/check_postgres.pl "$pkgdir"/usr/bin/check_postgres
}

sha512sums="ab7d4b231f1428f549a2da0370de63c39d54287f8284c65044d1aa8fed120d89e9730c3b614004fdc298536402330ccac43d2d9dfe8b20cc5aff6f89f7be0915  check_postgres-2.25.0.tar.gz"
